cmake_minimum_required(VERSION 3.5)

project(testcalculatescore LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
# Check https://doc.qt.io/qt/deployment-android.html for more information.
# They need to be set before the find_package( ...) calls below.

#if(ANDROID)
#    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
#    if (ANDROID_ABI STREQUAL "armeabi-v7a")
#    endif()
#endif()

find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Test REQUIRED)

set(PROJECT_SOURCES
        main.cpp
        calculateitem1testjson.h
        calculateitem1testjson.cpp
        calculateitem2testjson.h
        calculateitem2testjson.cpp
        calculateitem3testjson.h
        calculateitem3testjson.cpp
        calculateitem4testjson.h
        calculateitem4testjson.cpp
        calculateitem5testjson.h
        calculateitem5testjson.cpp
        calculateitem6testjson.h
        calculateitem6testjson.cpp
        calculateitem7testjson.h
        calculateitem7testjson.cpp
        calculateitem8testjson.h
        calculateitem8testjson.cpp
        calculateitem9testjson.h
        calculateitem9testjson.cpp
        calculateitem10testjson.h
        calculateitem10testjson.cpp
        calculateitem12testjson.h
        calculateitem12testjson.cpp
        calculateitem13testjson.h
        calculateitem13testjson.cpp
        calculateitem14testjson.h
        calculateitem14testjson.cpp
        calculateitem3newtestjson.h
        calculateitem3newtestjson.cpp

)

# 添加 ../compare 目录中的源文件
set(COMPARE_SOURCES
    ../../compare/cschprocessposition.cpp
    ../../compare/cjgorderprocess.cpp
    ../../compare/cjgprocessschedule.cpp
    ../../compare/cschdatacollector.cpp
    ../../compare/csysparamdata.cpp
    ../../compare/ctechmanager.cpp
    ../../compare/cworkertech.cpp
    ../../compare/cjgpositionmanager.cpp
    ../../compare/cjgposition.cpp
    ../../compare/cprescheduling.cpp
    ../../compare/cjgdepandency.cpp
    ../../compare/global.cpp
    ../../compare/cjgorder.cpp
    ../../compare/cjgboxset.cpp
    ../../compare/ctech.cpp
    ../../compare/cordermanager.cpp
    ../../compare/cjgprocessplan.cpp
)

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
    qt_add_executable(testcalculatescore
        ${PROJECT_SOURCES}
        ${COMPARE_SOURCES}
    )
else()
    if(ANDROID)
        add_library(testcalculatescore SHARED
            ${PROJECT_SOURCES}
            ${COMPARE_SOURCES}
        )
    else()
        add_executable(testcalculatescore
            ${PROJECT_SOURCES}
            ${COMPARE_SOURCES}
        )
    endif()
endif()

target_include_directories(testcalculatescore PRIVATE
    ../../compare
)

target_link_libraries(testcalculatescore PRIVATE
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Test
)
